import website  from '@/framework-core/config/website';
import {validateRules} from "@/framework-core/utils/validateRule";

export const tableOption = {
    "border": true,
    "index": true,
    "indexLabel": "#",
    "stripe": true,
    "menuAlign": "center",
    "align": "center",
    "searchMenuSpan": 6,
    searchEnter: true,
    selection: true,
    grid: window.isMobile,
    gridSpan: 24,
    menuWidth: 200,
    "column": [


        {
            "type": "input",
            "label": "模板名称",
            "prop": "name",
            "overHidden": false,
            minWidth: '80px',
            "rules": [{
                required: true,
                message: '模板名称不能为空',
                trigger: 'blur'
            }],
            'search': true,
            "span": 12
        }
        ,
        {
            "type": "input",
            "label": "公章名称",
            "prop": "sealName",
            minWidth: '80px',
            "overHidden": false,
            "rules": [{
                required: true,
                message: '公章名称不能为空',
                trigger: 'blur'
            }],
            'search': true,
            "span": 12
        }

        ,
        {
            "type": "input",
            "label": "公司名称",
            "prop": "company",
            "overHidden": false,
            minWidth: '100px',
            "rules": [{
                required: true,
                message: '公司名称不能为空',
                trigger: 'blur'
            }],
            'search': true,
            "span": 12
        }

        ,
        {
            "type": "input",
            "label": "红头标题",
            "prop": "redTitle",
            "overHidden": false,
            minWidth: '100px',
            value: 1,
            "rules": [{
                required: true,
                message: '红头标题不能为空',
                trigger: 'blur'
            }],
            'search': true,
            "span": 12
        }
        ,
        {
            "type": "select",
            "label": "是否透明",
            "prop": "transparent",
            "overHidden": false,
            with: '50px',
            dicData: [{
                label: '否',
                value: 0
            }, {
                label: '是',
                value: 1
            }],
            "rules": [{
                required: true,
                message: '是否透明不能为空',
                trigger: 'blur'
            }],
            value: 1,
            'search': true,
            "span": 12
        }, {
            label: "章",
            prop: "img",
            listType: 'picture-img',
            type: "upload",
            "minWidth": "60px",
            addDisplay: false,
            editDisplay: false
        },
        {
            "type": "textarea",
            "label": "模板",
            "prop": "tpl",
            minWidth: '200px',
            "overHidden": false,
            "rules": [{
                required: true,
                message: '模板不能为空',
                trigger: 'blur'
            }],
            html: true,
            formatter: (val, value, label) => {
                let temp = ' <div style="color: red;font-weight: 900;text-align: center;">' + val.redTitle + '</div><div style="color: #000000;text-align: center;font-size: 12px;">' + val.company + '（' + (val.year || "2024") + '）第【' + (val.num || "1") + '】号</div>';
                return temp;
            },
            'search': false,
            "span": 24
        },
        {
            "type": "upload",
            "label": "章",
            "prop": "img",
            "overHidden": false,


            hide: true,
            listType: 'picture-img',
            propsHttp: {
                url: 'url',
                name: 'name',
                res: 'data.data'
            },
            limit: 1,
            loadText: '图片上传中，请稍等',
            canvasOption: {
                text: "",
                ratio: 0.1,
            },
            accept: 'image/png, image/jpeg',
            // cropperOption: {
            //     autoCropWidth: 100,
            //     autoCropHeight: 100,
            //     fixed: true,
            //     fixedNumber: [100, 100],
            // },
            tip: '只能上传jpg/png文件，且不超过500kb',
            action: website.baseUrl + "/api/sys/file/upload",
            "rules": [{
                required: false,
                message: '图片不能为空',
                trigger: 'blur'
            }],
            'search': false,
            "span": 24
        }
    ]
}
